<template>
  <view class="selector-item">
    <view class="selector-item_checkbox">
      <ve-icon v-if="selected" name="icon-checkbox-select" width="28"></ve-icon>
      <ve-icon v-else name="icon-checkbox" width="28"></ve-icon>
    </view>
    <view :class="['selector-item_label', record.option.phone ? 'center' : '']">
      <view :class="['selector-item_label-title', record.option.phone ? 'title-ellipsis' : '']"> {{ record.label }} </view>
      <view class="selector-item_label-phone" v-if="record.option.phone"> {{ record.option.phone }} </view>
      <view
        v-if="record.option.statusName"
        class="selector-item_label-tag"
        :class="{
          blue: record.option.status == 1, // 在职
          orange: record.option.status == 0, // 离职
          gray: record.option.status == 2, // 停用
        }"
      >
        {{ record.option.statusName }}
      </view>
    </view>
    <view class="selector-item_desc" v-if="record.option.organizationName">{{ record.option.organizationName }}</view>
  </view>
</template>

<script setup lang="ts">
  defineProps({
    selected: {
      type: Boolean,
      default: false,
    },
    record: {
      type: Object,
      default: () => ({}),
    },
  })
</script>

<style lang="less" scoped>
  .tag-box {
    display: flex;
    align-items: center;
    width: 120rpx;
    height: 42rpx;
  }
  .selector-item {
    display: flex;
    flex-direction: column;
    position: relative;
    background: #ffffff;
    border-radius: 8rpx;
    padding: 32rpx;
    margin: 24rpx;
    &_checkbox {
      position: absolute;
      top: 30rpx;
      right: 32rpx;
    }

    &_label {
      display: flex;
      justify-content: flex-start;
      margin-right: 44rpx;
      &.center {
        align-items: center;
      }
      .selector-item_label-title {
        flex: 1;
        font-size: 30rpx;
        color: #191c27;
        word-break: break-all;

        &.title-ellipsis {
          flex: none;
          font-weight: 600;
          max-width: 266rpx;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }
      .selector-item_label-phone {
        margin-left: 32rpx;
        font-size: 30rpx;
        font-family: PingFang SC, PingFang SC;
        font-weight: 400;
        color: #191c27;
      }
      .selector-item_label-tag {
        display: flex;
        align-items: center;
        justify-content: center;
        // width: 72rpx;
        height: 32rpx;
        line-height: 28rpx;
        margin-left: 16rpx;
        padding: 0 12rpx;
        font-size: 24rpx;
        font-weight: 400;
        border-radius: 1289px 1289px 1289px 1289px;
        border: 2rpx solid #165dff;
      }
      .blue {
        color: #165dff;
        background-color: rgba(243, 247, 255, 1);
        border-color: #165dff;
      }
      .gray {
        color: #959595;
        background-color: #eceef1;
        border-color: #959595;
      }
      .orange {
        color: #ff7d00;
        background-color: #fff7e8;
        border-color: #ff7d00;
      }
    }

    &_desc {
      margin-top: 12rpx;
      margin-right: 24px;
      font-size: 30rpx;
      font-weight: 400;
      color: #8491a8;
      line-height: 40rpx;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
  }
</style>
